GBML manual / Rooms

region_current

Which region the player is in, as a number you compare with the region words your game gets: rg_forest for a region called "Forest", rg_the_old_road for "The Old Road". It is the last region the player was in, so it stays right inside a house. -1 before the player has been in any. It works in a long room cut into regions too: the player is the object the camera follows.

Syntax

region_current() -> int

Returns

int

Description

Which region the player is in, as a number you compare with a region word. Every region of every world gets a word made from its name in the Regions list, with rg_ in front, in lower case, and every run of other characters turned into one _: a region called "Crypt" is rg_crypt, "The Old Road" is rg_the_old_road. If two regions would get the same word the second one is numbered (rg_forest_2).

The answer is the last region the player was in, so it stays right inside a house (a room that is not part of a world). It is -1 before the player has been in any region.

Rename a region in the Regions list and the word follows in your code, the way renaming a room does: the places in your code that use the old word are found and changed.

A long room's regions have words too: a region called \Pier\ in a room cut into regions is \ g_pier\. The answer changes when the object the camera follows walks across a border between two regions of the room.

Example

if (region_current() == rg_crypt) {
    draw_text(8, 8, "Mind the dark");
}

Shows a warning while the player is in the crypt, in its houses too.

On the GBA

The words come from the Regions list of a world or of a long room: renaming a region renames them in your code the way renaming a room does.

See also: region_nameregion_previousregion_atregion_enteredWhat a region does in the game